//package com.zry.study.utils;
//
//import android.app.Activity;
//import android.app.Dialog;
//import android.view.View;
//import android.view.Window;
//import android.view.WindowManager;
//
//import com.zry.study.R;
//
//public class DialogUtil {
//
//	public Dialog dialog;
//	public View view;
//	private Activity activity;
//	private int layoutId;
//	private Boolean booleanStr;
//	private int gravity;
//	private int x;
//	private int y;
//
//	public DialogUtil(Activity activity, int layoutId, Boolean booleanStr, int gravity, int x, int
//		                                                                                           y) {
//		this.activity = activity;
//		this.layoutId = layoutId;
//		this.booleanStr = booleanStr;
//		this.gravity = gravity;
//		this.x = x;
//		this.y = y;
//	}
//
//	public void init() {
//		dialog = new Dialog(activity, R.style.dialogStyle);
//		dialog.setCanceledOnTouchOutside(true);
//		Window dialogWindow = dialog.getWindow();
//		WindowManager.LayoutParams layoutParams = dialogWindow.getAttributes();
//		if (booleanStr) {
//			dialogWindow.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
//			dialogWindow.setGravity(gravity);
//			layoutParams.x = x;
//			layoutParams.y = y;
//			int width = activity.getResources().getDimensionPixelOffset(R.dimen.margin_240);
//			int height = activity.getResources().getDimensionPixelOffset(R.dimen.margin_270);
//			//dialog的大小
//			layoutParams.width = width;
//			layoutParams.height = height;
//		}
//
//		int width = activity.getResources().getDimensionPixelOffset(R.dimen.margin_240);
//		int height = activity.getResources().getDimensionPixelOffset(R.dimen.margin_240);
//		//dialog的大小
//		layoutParams.width = width;
//		layoutParams.height = height;
//		dialogWindow.setAttributes(layoutParams);
//
//		 view = activity.getLayoutInflater().inflate(layoutId, null);
//		dialog.setContentView(view);
//		dialog.show();
//	}
//
//	/**
//	 * 关闭dialog
//	 */
//	public void dialogDismiss() {
//		dialog.dismiss();
//	}
//
//}
//
